<template>
  <view class="content">
    <button @click="wxlogon">nihao</button>
    <button class="btnLogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
      本机号码一键登录
    </button>
  </view>
</template>

<script>
  export default {
    methods: {
      getPhoneNumber(e) {
        console.log(e.detail.code, 'e')
        wx.login({
          success(res) {
            console.log(res, 'res')
          }
        })
      },
      wxlogon() {
        uni.getUserInfo({
          desc: "登录",
          success(res) {
            uni.login({
              provider: 'weixin', //使用微信登录
              success(loginRes) {
                console.log(loginRes);
              }
            });
          }
        })
      }
    }
  }
</script>

<style>
  .content {
    width: 200rpx;
    height: 200rpx;
    border: 2rpx red solid;
  }
</style>